package com.shopping.serviceImpl;

import com.shopping.dao.OrdersDao;
import com.shopping.pojo.Orders;
import com.shopping.pojo.vo.OrdersInfo;
import com.shopping.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrdersServiceImpl implements OrdersService {
    @Autowired
    private OrdersDao ordersDao;

    @Override
    public List<OrdersInfo> selectOrdersByQuery(String orderId, String userName, int start, int limit) {
        return ordersDao.selectOrdersByQuery(orderId, userName, start, limit);
    }

    @Override
    public int getOrdersNum(String orderId, String userName) {
        return ordersDao.getOrdersNum(orderId, userName);
    }

    @Override
    public List<OrdersInfo> selectOrdersInfoByBusinessId(String businessId, String orderId) {
        return ordersDao.selectOrdersInfoByBusinessId(businessId, orderId);
    }

    @Override
    public List<OrdersInfo> selectOrdersByUserId(Integer userId) {
        return ordersDao.selectOrdersByUserId(userId);
    }

    @Override
    public boolean insertOrder(Orders orders) {
        return ordersDao.insertOrder(orders) > 0;
    }

    @Override
    public int selectIdByOrderId(String orderId) {
        return ordersDao.selectIdByOrderId(orderId);
    }

    @Override
    public OrdersInfo selectOrdersByOrderId(Integer id) {
        return ordersDao.selectOrdersByOrderId(id);
    }


}
